var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]);
    })(e, t);
}, function(e, t) {
    function r() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (r.prototype = t.prototype, 
    new r());
}), a = this && this.__decorate || function(e, t, r, n) {
    var i, a = arguments.length, s = a < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, r) : n;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, r, n); else for (var o = e.length - 1; 0 <= o; o--) (i = e[o]) && (s = (a < 3 ? i(s) : 3 < a ? i(t, r, s) : i(t, r)) || s);
    return 3 < a && s && Object.defineProperty(t, r, s), s;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("Global"), s = e("PetManager"), c = e("LoadManager"), l = cc._decorator, d = l.ccclass, u = l.property, p = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.bg = null, e.sprite = null, e.current = null, e.already = null, e.numLabel = null, 
        e;
    }
    return i(e, t), e.prototype.start = function() {}, e.prototype.refresh = function(e) {
        var t = this;
        switch (e.type) {
          case r.RewardType.DIAMOND:
            c.default.getInstance().loadSpriteFrame({
                url: "image/ui/钻石@2x",
                sprite: this.sprite,
                success: function() {
                    t.sprite.node.scale = 1;
                }
            }), this.numLabel.string = e.num.toString();
            break;

          case r.RewardType.SKIN:
            c.default.getInstance().loadSpriteFrame({
                url: "image/skin/" + e.idx,
                sprite: this.sprite,
                success: function() {
                    t.sprite.node.scale = 1;
                }
            }), this.numLabel.string = "免费皮肤";
            break;

          case r.RewardType.PET:
            c.default.getInstance().loadSpriteFrame({
                url: "image/skin3/" + e.idx,
                sprite: this.sprite,
                success: function() {
                    t.sprite.node.scale = 1;
                }
            }), this.numLabel.string = "机器狗";
            break;

          case r.RewardType.PIECE:
            c.default.getInstance().loadSpriteFrame({
                url: "image/ui/碎片@2x",
                sprite: this.sprite,
                success: function() {
                    t.sprite.node.scale = .5;
                }
            }), this.numLabel.string = e.num.toString();
            break;

          case r.RewardType.DRAGON:
            c.default.getInstance().loadSpriteFrame({
                url: "image/skin3/" + s.default.getInstance().getPetDataIdx(e.idx),
                sprite: this.sprite,
                success: function() {
                    t.sprite.node.scale = 1;
                }
            }), this.numLabel.string = "机器龙";
        }
    }, e.prototype.showCurrent = function() {
        this.bg.spriteFrame = this.current;
    }, e.prototype.showAlready = function() {
        this.bg.spriteFrame = this.already;
    }, a([ u(cc.Sprite) ], e.prototype, "bg", void 0), a([ u(cc.Sprite) ], e.prototype, "sprite", void 0), 
    a([ u(cc.SpriteFrame) ], e.prototype, "current", void 0), a([ u(cc.SpriteFrame) ], e.prototype, "already", void 0), 
    a([ u(cc.Label) ], e.prototype, "numLabel", void 0), a([ d ], e);
}(cc.Component);

n.default = p;